package org.freedom.fastdevpt.gos.accounts.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.freedom.fastdevpt.gos.accounts.pojo.Account;
import org.freedom.fastdevpt.gos.accounts.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller()
@RequestMapping("/gos/account")
public class AccountController {

	@Autowired
	private AccountService accountService;
	@RequestMapping("/detail")
	public String detail( Integer pk ,HttpServletRequest request){
		Account account = accountService.getByPk(pk);
		request.setAttribute("dt", account);
		return "gos/account/detail";
	}
	@RequestMapping("/del")
	@ResponseBody
	public Object del(@RequestParam(value = "pk[]") Integer[] pk,HttpServletResponse rs){
		
		try {
			accountService.batchdelete(pk);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		 
		return null;
	}
	
	
}
